package com.jeespring.rocketmq;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description SendMessageController
 * @author 张朝阳
 * @date 2021/9/20 1:18:18
 */

@RestController
@RequestMapping("/")
public class SendMessageController {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @RequestMapping("/sendMessage")
    public void sendMessage(){
        String message = "{\"name\":\"zhangchaoyang\"}";
        rocketMQTemplate.convertAndSend("topic1", message);
    }
}
